home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
mdishe
/
app.bas
next >
Wrap
BASIC Source File
|
1994-12-29
|
7KB
|
284 lines
' ********************************************************
' MDI Standard Application Shell
' ********************************************************
'
' SUMMARY
' -------
' This file is part of an MDI application "skeleton"
' created by John Blessing of Leigh Business Enterprises Ltd.
'
' FEATURES
' --------
' Selection of application database.
' Compact/Repair of database.
' 'Helptips' on toolbar items.
' Support for Help files.
' MDI child forms tiling etc.
' Error trapping.
' 'Nag' screen support for shareware authors.
' Support for 3D dialogs (switched off in design mode
' to prevent GPFs)
'
' USE
' ---
' You need VB Pro to use this shell, although it could be
' modified to run under the standard edition.
'
' You will need to set up some information in APP.BAS,
' particularly in SetAppInfo(). You will also need to add
' your own application specific code to this module.
'
' DISTRIBUTION
' ------------
' This program is "FreeWare" and may be used and distributed
' as you wish.
'
' It incorporates some ideas/code from other authors and these
' are acknowledged in the appropriate module.
'
' We hope that you will find it useful. If you wish to discuss it
' then please e-mail us on Compuserve 100444,623.
'
' ADVERTISEMENT!
' --------------
' Are you looking for a helpdesk system? Or does your company
' want to track and monitor the progress of any work activity?
' We market a system which could be of interest to you.
'
' PROGRESS is available for download from the Business section
' of the Windows Shareware forum on Compuserve
' (filename PRGRSS10.ZIP). It's a large program, so in the
' same section you will also find the help files and
' documentation as PRGSSDOC.ZIP which is quicker to download
' and will give you a good idea of the functionality of PROGRESS.
'
' Dec 1994
Option Explicit
'======================================================================
'Form/Module:
' App.bas
'
'Procedure:
' bValidDbase
'
'Modifications:
' 25/12/94 JBL Build
'
'Description:
' Checks the specified application database and returns True/False
'
'======================================================================
Function bValidDbase (sDbase As String) As Integer
'General Error Handler
If Not bDesignMode() Then
On Error GoTo Error_bValidDbase
End If
'check for existence
If Not bFileExists(sDbase) Then
MsgBox tGApp.sDbaseName & "cannot be found.", MB_OK Or MB_ICONEXCLAMATION
bValidDbase = False
Exit Function
End If
'put your code here to validate the database as one for
'your application
'
'e.g. you might have a "system" table - one field of which holds
'the app name and the other the version number.
'Checking these would enable you to make sure that it
'is the correct database and that it is a compatible
'version.
'
'Default behaviour for testing purposes
bValidDbase = True
Exit Function
Error_bValidDbase:
'call the generic error handler
GenErrorHandler "App.bas - bValidDbase()", Err, Error$
Resume Exit_bValidDbase
Exit_bValidDbase:
End Function
'======================================================================
'Form/Module:
' App.bas
'
'Procedure:
' CreateAppDbase
'
'Parameters:
' sDbase Name of database to create
'
'Returns:
' None
'
'Modifications:
' 29/12/94 JBL Build
'
'Description:
' Creates your application's database
'======================================================================
'
Sub CreateAppDbase (sDbase As String)
'General Error Handler
If Not bDesignMode() Then
On Error GoTo Error_CreateAppDbase
End If
'put your code to create the database here
MsgBox "Put your own code here to create the application database."
Exit Sub
Error_CreateAppDbase:
'call the generic error handler
GenErrorHandler "App.bas - CreateAppDbase()", Err, Error$
Resume Exit_CreateAppDbase
Exit_CreateAppDbase:
End Sub
'======================================================================
'Form/Module:
' App.bas
'
'Procedure:
' SetAppInfo
'
'Parameters:
' None
'Returns:
' None
'
'Modifications:
' 28/12/94 JBL Build
'
'Description:
' Specify information about the application
'======================================================================
'
Sub SetAppInfo ()
'General Error Handler
If Not bDesignMode() Then
On Error GoTo Error_SetAppInfo
End If
'this is the name of your application
tGApp.sName = "Standard Application"
'if you leave this as an empty string then the Help
'menu item on mdiMain will be made invisible.
'just enter the name of the help file - not the path.
'It is assumed that the help file will be in the
'same directory as the application.
tGApp.sHelpFile = "winhelp.hlp" 'set to winhelp.hlp for testing purposes
'if you app has an ini file then put it's name here
'The ini file will be created in the user's private
'windows directory, so don't specify a path.
'This entry is required if you want to use the shareware
'nag screen below
tGApp.sIniFile = "stdapp.ini"
'complete this if you want to trigger the shareware
'nag screen fUsage.frm
tGApp.bEvaluation = True 'default
'this is the .wri file loaded by the
'Ordering Information option under the Help menu
tGApp.sOrderInfoFile = ""
'complete this to log all errors in a session to a logfile
'which will be created in the user's private windows dir
tGApp.sErrorFile = "stdapp.err"
'this is the version number of the application
tGApp.dVersion = 1.1
'This is the number of buttons on your toolbar.
'You must have the same number of icons loaded into the
'PicClip control on the mdiMain form.
'Don't forget to set the tag property of each button so
'that the helptip is correct.
tGApp.iToolButtonCount = 4
Exit Sub
Error_SetAppInfo:
'call the generic error handler
GenErrorHandler "App.bas - SetAppInfo()", Err, Error$
Resume Exit_SetAppInfo
Exit_SetAppInfo:
End Sub
'======================================================================
'Form/Module:
' App.bas
'
'Procedure:
' ToolbarAction
'
'Parameters:
' iButtonIndex
'
'Returns:
' None
'
'Modifications:
' 28/12/94 JBL Build
'
'Description:
' Specify action for each toolbar button
'======================================================================
'
Sub ToolbarAction (iButtonIndex As Integer)
'General Error Handler
If Not bDesignMode() Then
On Error GoTo Error_ToolbarAction
End If
Select Case iButtonIndex
Case 0 'New
'same as File New
NewDbase
Case 1 'open
'same as File Open
OpenDbase
'add in the actions for the rest of your toolbar below
Case 2 'print
Case 3 'save
End Select
Exit Sub
Error_ToolbarAction:
'call the generic error handler
GenErrorHandler "App.bas - ToolbarAction()", Err, Error$
Resume Exit_ToolbarAction
Exit_ToolbarAction:
End Sub